<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" href="__CSS__/ex/common.css">
	<link rel="stylesheet" href="__CSS__/ex/login.css">
	<title>EX</title>
    <script src="__JS__/ios-web-app.js"></script>
</head>

<body>
	<div class="login">
		<div class="header">
			<div class="header_left"><a href="javascript:history.back(-1)"><img src="__IMG__/ex/back.png" alt=""></a></div>
			<p>Đăng ký</p>
			<div class="header_right"></div>
		</div>
		<div class="loginform register">
            <div class="form_content username">
                <img src="__IMG__/ex/user.png" alt="">
                <div class="line"></div>
                <input type="text" placeholder="Tên" id="username">
            </div>
            <!--<div class="form_content username">-->
                <!--<img src="__IMG__/ex/pay.png" alt="">-->
                <!--<div class="line"></div>-->
                <!--<input type="text" placeholder="Nhập tên ví tiền" id="wallet_name">-->
            <!--</div>-->
            <div class="form_content username">
                <img src="__IMG__/ex/mobile.png" alt="">
                <div class="line"></div>
                <select class="selectchoose" name="phone_ex" id="phone_ex">
                    <option value="86">+86</option>
                    <option value="0084">+0084</option>
                    <option value="0060">+0060</option>
                    <option value="00855">+00855 </option>
                    <option value="0066">+0066</option>
                    <option value="0065">+0065</option>
                    <option value="0081">+0081</option>
                    <option value="0082">+0082</option>
                    <option value="00856">+00856</option>
                    <option value="0095">+0095</option>
                    <option value="00886">+00886</option>
                    <option value="001">+001</option>
                    <option value="0049">+0049</option>
                    <option value="0033">+0033</option>
                </select>
                <input type="text" placeholder="Nhập số điện thoại " id="phone">
            </div>
            <div class="form_content username">
                <img src="__IMG__/ex/pwd.png" alt="">
                <div class="line"></div>
                <input type="password" placeholder="Nhập mật khẩu" id="password">
            </div>
            <div class="form_content username">
                <img src="__IMG__/ex/pwd.png" alt="">
                <div class="line"></div>
                <input type="password" placeholder="Xác nhận mật khẩu" id="password_re">
            </div>
            <div class="form_content username">
                <img src="__IMG__/ex/pay.png" alt="">
                <div class="line"></div>
                <input type="password" placeholder="Nhập mật khẩu thanh toán" id="password2">
            </div>
            <div class="form_content username">
                <img src="__IMG__/ex/recom.png" alt="">
                <div class="line"></div>
                <input type="text" placeholder="Mã giới thiệu" id="higher" value="{$higher}">
            </div>
			<div class="btn login_btn lsub" id="sub">Đăng ký</div>
		</div>
	</div>
    <style>
        .selectchoose{
            background-color: transparent;
            color: #646464;
            border: 1px solid #eaeaea;
            height: .6rem;
            line-height: .6rem;
            -webkit-border-radius: .04rem;
            -moz-border-radius: .04rem;
            border-radius: .04rem;
            padding: 0 .08rem;
            margin-right: .08rem;
        }
    </style>
	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        $(function() {
            //发送验证码
            // $("#getCode").on('click', function () {
            //     var num = 59;
            //     var that = $(this);
            //     var phone = $('#phone').val();
            //     if (phone == '') {
            //         alert('请输入注册的手机号码');
            //     } else if (!(/^1[34578]\d{9}$/.test(phone))) {
            //         alert('手机号码格式不正确');
            //     } else {
            //         $.post("{:U('Public/sendCode')}", {"phone": phone}, function (data) {
            //             alert(data.message);
            //             console.log(data)
            //             var timer = setInterval(function () {
            //                 that.attr('id', '');
            //                 that.text(num + 's');
            //                 that.addClass('active');
            //                 num--;
            //                 if (num == 0) {
            //                     that.attr('id', 'getCode');
            //                     clearInterval(timer);
            //                     that.text('重新发送验证码');
            //                 }
            //             }, 1000);
            //         })
            //     }
            // });
            //注册
            $('#sub').click(function(){
                $.ajax({
                    type:"post",
                    url:"{:U('register')}",
                    data:{
                        username:$('#username').val(),
                        // wallet_name:$("#wallet_name").val(),
                        phone_ex:$("#phone_ex").val(),
                        phone:$('#phone').val(),
                        // code:$('#code').val(),
                        password:$('#password').val(),
                        password_re:$("#password_re").val(),
                        password2:$('#password2').val(),
                        higher:$('#higher').val(),
                    },
                    dataType:"json",
                    success:function(data){
                        if(data.code==1){
                            alert(data.msg);
                        }else{
                            alert(data.msg);
                            window.location.href=data.data;
                        }
                    }
                });
            });
        })
    </script>
</body>

</html>